//
// Created by 11510 on 2024/6/20.
//
#include <iostream>
#include <string>
#include <cstring>
#include <vector>

using namespace std;


class Point {
public:
    Point(double x, double y)
            : _x(x), _y(y) {}

    template<class T = int>
    T convert() {
        return (T) _x;
    }

    /**
     * 可以加static，不可加virtual
     * @tparam T
     * @param t1
     * @return
     */
    template<class T> T add(T t1);

private:
    double _x;
    double _y;
};

template<class T>
T Point::add(T t1) {
    return _x + _y + t1;
}





void test0() {
    Point pt(1.1, 2.2);
    cout << pt.convert<int>() << endl;
    cout << pt.convert() << endl;

    cout << pt.add(1.2) << endl;
}


int main() {
    test0();

    return 0;
}